define(["jquery", "easy-admin"], function ($, ea) {
	
	var tableSelect = layui.tableSelect;
	
	var laydate = layui.laydate;
	laydate.render({
		elem: '#test2'//指定元素
    	,type: 'date'
    	,format: 'yyyy-MM-dd'
    });
	
	
	var name = window.CONFIG.INTEGRAL_NAME;

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'dpjz.user/index?',
        add_url: 'dpjz.user/add',
        edit_url: 'dpjz.user/edit',
        delete_url: 'dpjz.user/delete',
        export_url: 'dpjz.user/export',
        modify_url: 'dpjz.user/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar:['refresh','delete','export'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'nickname',fieldAlias:'dpjz_user.nickname', title: '昵称',templet:function(d){
                    	return "<img style='max-width:25px;' src='"+d.avatar+"'></img>"+d.nickname;
                    }},                    {field: 'win', title: "赢",search:false},                    {field: 'lose', title: '输',search:false},
                    {field: 'win_rate', title: '胜率',search:false},                    {field: 'create_time',fieldAlias:'dpjz_user.create_time', title: '创建时间',search:'range'},                    {width: 480, title: '操作', templet: "#test-table-operate-barDemo"},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        update: function () {
            ea.listen();
        },
        ranking: function () {
            ea.listen();
        },
    };
    return Controller;
});